﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using K.Contract;
using K.EnterpriseLibary.Entity;
namespace K.ClientPublic.Community.User
{
    /// <summary>
    /// 提供客户端中有关用户的各种的操作，此类为静态类，在客户端运行时被启用
    /// </summary>
    public static class UserPublic
    {
        /// <summary>
        /// 创建一个用于用户服务的服务工厂
        /// </summary>
        private static ServiceFactory<IUserService> userServiceFactory = new ServiceFactory<IUserService>();

        /// <summary>
        /// 类中的静态方法，以对应的接口来实现相应服务操作
        /// </summary>
        private static IUserService userService
        {
            get { return userServiceFactory.Service; }
        }

        /// <summary>
        /// 初始化用户服务
        /// </summary>
        /// <param name="factory">用于实例化用户服务的委托方法</param>
        public static void Inititalize(ServiceFactoryDelegate<IUserService> factory)
        {
            userServiceFactory.Initialize(factory);
        }


        public static bool CheckUserExsit(string inputStr, int LoginType)
        { 
            return userService.CheckUserExsit(inputStr,LoginType);
        }

        public static EnumRegister Register(UserInfo userInfo, UserBaseInfo userBaseInfo, out int uid) 
        {
            return userService.Register(userInfo, userBaseInfo, out uid) ;
        }

        public static UserInfo GetUserInfo(int userId)
        {
            return userService.GetUserInfo(userId);
        }
        
        
    
    
    }
}
